package com.tencent.cloud.iov.recycler.block;

import android.view.Gravity;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import com.tencent.cloud.iov.block.BaseBlockLayout;
import com.tencent.cloud.iov.block.Block;

/**
 * @author showxiao
 * @date 2018/9/6
 */
@Block
public class ErrorResultLayout extends BaseBlockLayout<IErrorResultItem> {

    @Override
    protected View createView(ViewGroup parent) {
        TextView textView = new TextView(parent.getContext());
        textView.setLayoutParams(new ViewGroup.LayoutParams(
                ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT
        ));
        textView.setGravity(Gravity.CENTER);
        return textView;
    }

    @Override
    protected void bindView(IErrorResultItem item, int position) {
        ((TextView) getView()).setText(item.getText());
    }
}
